package com.qianyu.project.service.impl;

import cn.hutool.core.date.DateUtil;
import com.qianyu.project.entity.SubSettle;
import com.qianyu.project.mapper.SubSettleMapper;
import com.qianyu.project.service.ISubSettleService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author gs
 * @since 2021-01-30
 */
@Service
public class SubSettleServiceImpl extends ServiceImpl<SubSettleMapper, SubSettle> implements ISubSettleService {

    @Autowired
    private SubSettleMapper subSettleMapper;

    @Override
    public String getMaxCode() {
        String code = subSettleMapper.selectMaxCode();
        if(code == null){
            code = DateUtil.today().replaceAll("-", "") + "00";
        }
        return code;
    }

    @Override
    public List<SubSettle> getSubcontracts(Map<String, Object> map) {
        return subSettleMapper.getSubcontracts(map);
    }
}
